<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui/css/layui.css" media="all">

    <script type="text/javascript" src="../../../res/js/jquery-3.4.1.min.js"></script>

</head>

<body>


<table class="layui-hide" class="list" id="test" lay-filter="test"></table>


<script src="../../../res/layui/layui.js" charset="utf-8"></script>
<script type="text/html" id="toolbarDemo">
    <div class="layui-inline">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <select name="mpFinished" id="mpFinished" lay-verify="required">
                <option></option>
                <option value="否">否</option>
                <option value="已完成">已完成</option>
            </select>
        </div>
    </div>


    <div class="layui-btn-container layui-inline">

        <button class="layui-btn" lay-event="reload">搜索</button>
    </div>
</script>
<script>


    var el = null;
    var openIndex = null;
    var table = null;
    var array = new Array();
    layui.use(['table', 'layer'], function () {
        table = layui.table;

        table.render({
            elem: '#test'
            , url: '../../../manufacturePlan/findAll'
            , toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
            /*, defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                title: '提示'
                , layEvent: 'LAYTABLE_TIPS'
                , icon: 'layui-icon-tips'
            }]*/
            , title: '用户数据表'
            , cols: [[
                {field: 'planName',title:'计划名称',width:120}
                , {field: 'drugName', title: '药品名称', width: 120}
                , {field: 'mpTask', title: '计划完成任务', width: 100}
                , {field: 'mpFinished', title: '是否完成', width: 150}
                , {field: 'mpTime', title: '制造时间',width:200}
                , {field: 'mpUnfinished', title: '未完成部分', width: 150}
                , {field: 'mpScheme', title: '处理方案', width: 100}
                // , {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 220}
            ]]
            , page: true
        });

        //头工具栏事件
        table.on('toolbar(test)', function (obj) {
            switch (obj.event) {
                case 'reload':
                    table.reload('test', {
                        where: {
                            mpFinished: $("#mpFinished").val()
                        }
                        , page: {
                            curr: 1
                        }
                    })
                    break;
            }
        })



    });




    /**
     * 关闭层
     */
    function closeOpen(msg) {
        layer.close(openIndex);
        layer.msg(msg, {time: 1000}, function () {
            table.reload("test");//刷新表格
        })
    }



</script>
</body>
</html>